﻿<%@ Page Language="C#" Title="观测站管理" MasterPageFile="~/W_View/PageMaster.Master" CodeBehind="S_StationPage.aspx.cs" Inherits="STHPMS1.Web.W_View.Basis.S_StationPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/datagrid.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/dropdown.js")%>
    
    <script type="text/javascript">      

        function S_StationEdit(flag)
        {
            var row = $('#dg').datagrid('getSelected');
            var title="";
            if (flag == 0)
            {
                if (!row) {
                    $.messager.alert('消息提示', '编辑数据时，请选择一项!', 'warning');
                    return;
                }
                $('#fm').form('load', row);
                title="新增测试数据";
            }
            else
            {
                $('#fm').form('clear');
                title="编辑测试数据";
            }

            $('#dlg').dialog('open');
        }

        function S_StationDel() {
            var row = $('#dg').datagrid('getSelected');
            if (!row) {
                $.messager.alert('消息提示', '删除数据时，请选择一项!', 'warning');
                return;
            }

            deleteData($('#dg'), $('#dlg'), "/api/station");
        }



        function search(n,o) {
            var region = $('#cmbRegion').combobox("getValue");
            var direction = $('#cmbDirection').combobox("getValue");
            var checkDate = $('#checkDate').datebox('getValue');  //注意.datebox('getValue')

            var url = '/api/station';
            var urlParam = "";
            if (region != "" && region!="0") urlParam += "region=" + encodeURI(region) + "&";
            if (direction != "" && direction!="0") urlParam += "direction=" + encodeURI(direction) + "&";
            if (checkDate != "") urlParam += "checkDate=" + encodeURI(checkDate) + "&";
            if (urlParam != "") {
                urlParam = "?" + urlParam.substring(0, urlParam.length - 1);
                url = url + urlParam;
            }

            $('#dg').datagrid({ url:  url,pageNumber:1});
        }
       

        $(function () {
            var number= '<%= Page.RouteData.Values["page"] %>';
            var size = '<%= Page.RouteData.Values["size"] %>';

            dataGridBind($('#dg'), '/api/station', '观测站列表显示', $('#tb'), number, size);

            $('.validatebox-text').bind('blur', function () {
                $(this).validatebox('enableValidation').validatebox('validate');
            });
        })

        
    </script>  
    
      
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table id="dg" class="easyui-datagrid content-place"  ajaxCached="false"  >
        <thead>
            <th data-options="field:'Statid',editor:'text',width:80,align:'right',hidden:true">观测站ID</th>
            <th data-options="field:'Statname',editor:'text',width:160,align:'right' ">观测站名称</th>
            <th data-options="field:'Apprdid',editor:'text',width:160,align:'right' " >应用区间路线编号</th>
            <th data-options="field:'Appbeginmp',editor:'numberbox',width:160,align:'right' "  formatter="formatPile" >应用区间起点桩号</th>
            <th data-options="field:'Appendmp',editor:'numberbox',width:160,align:'right' "  formatter="formatPile" >应用区间终点桩号</th>
        </thead>
    </table>
   
    <!--测试数据命令-->
    <div id="tb">
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="S_StationEdit(-1)">添加</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" onclick="S_StationEdit(0)">编辑</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="S_StationDel()">删除</a>
         
    </div>

    <!--测试详细页面-->
    <div id="dlg" class="easyui-dialog" title="保存数据" style="width:350px;height:200px;padding:10px" closed="true"  data-options="
				iconCls: 'icon-save',
				buttons: '#dlg-buttons'
			">
        <form id="fm" method="post" action="/api/station">
            <table>			     
                <tr style="display:none">
                    <td>观测站ID:</td>
                    <td><input name='Statid' class='easyui-validatebox easyui-textbox'  /></td>
                </tr>
                <tr>
                    <td>观测站名称:</td>
                    <td><input name='Statname' class='easyui-validatebox easyui-textbox' data-options="required:true, validType:'MaxLength[100]'" /></td>
                </tr>
                <tr>
                    <td>应用区间路线编号:</td>
                    <td><input name='Apprdid' class='easyui-validatebox easyui-textbox'  data-options=" required:true,validType:'MaxLength[50]'"/></td>
                </tr>
                <tr>
                    <td>应用区间起点桩号:</td>
                    <td><input name='Appbeginmp' class='easyui-validatebox easyui-numberbox'  data-options='required:true,min:0,precision:2,formatter:formatPile' /></td>
                </tr>
                <tr>
                    <td>应用区间终点桩号:</td>
                    <td><input name='Appendmp' class='easyui-validatebox easyui-numberbox'  data-options='required:true,min:0,precision:2,formatter:formatPile' /></td>
                </tr>
		    </table>
        </form>
    </div>

    <!--编辑数据命令-->
    <div id="dlg-buttons">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:sumbitData($('#dg'),$('#dlg'))">保存</a>
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#dlg').dialog('close')">取消</a>
	</div>

     
</asp:Content>
